package cn.cvs.service.impl;

import cn.cvs.dao.UserMapper;
import cn.cvs.pojo.User;
import cn.cvs.service.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class UserServiceImpl implements UserService {
    @Resource
    private UserMapper userMapper;
    @Override
    public User loginUserByUPhone(String uPhone, String uPassword) {
        User user = userMapper.getUserByUPhone(uPhone);
        if(user!=null){
            if(user.getuPassword().equals(uPassword)){
                return user;
            }
        }
        return null;
    }
    @Override
    public int addUser(User user) {
        return userMapper.addUser(user);
    }

    @Override
    public int updateUser(Integer uId) {
        return userMapper.updateUser(uId);
    }

    @Override
    public int updatePassWord(User user) {
        return userMapper.updatePassWord(user);
    }

    @Override
    public User getUserByUPhone(String uPhone) {
        return userMapper.getUserByUPhone(uPhone);
    }
}
